<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%--<base href="${pageContext.request.contextPath}/">--%>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="../image/favicon.ico" type="image/ico"/>

    <title>贵美后台管理系统</title>

    <!-- Bootstrap -->
    <link href="../css/bootstrapcss/bootstrap.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../css/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="../css/vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="../css/vendors/iCheck/skins/flat/green.css" rel="stylesheet">

    <link href="../css/vendors/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
    <link href="../css/vendors/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
    <link href="../css/vendors/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
    <link href="../css/vendors/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
    <link href="../css/vendors/datatables.net-scroller-bs/css/scroller.bootstrap.min.css" rel="stylesheet">


    <!-- bootstrap-progressbar -->
    <link href="../css/vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- JQVMap -->
    <link href="../css/vendors/jqvmap/dist/jqvmap.min.css" rel="stylesheet"/>
    <!-- bootstrap-daterangepicker -->
    <link href="../css/vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">

        <link href="../css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <!-- Custom Theme Style -->
    <link href="../css/build/css/custom.min.css" rel="stylesheet">

    <%
        request.setCharacterEncoding("utf-8");
    %>
    <style>
        form div {
            margin-top: 10px;
            margin-left: 15px;
        }

        #searchBtn {
            margin-top: 10px;
        }

        #searchBtn button {
            margin-left: 20px;
        }
    </style>
</head>

<body class="nav-md">
<div class="container body">
    <div class="main_container">

        <jsp:include page="left.jsp"/>

        <!-- top navigation -->
        <jsp:include page="top.jsp"/>
        <!-- /top navigation -->

        <!-- page content -->


        <div class="right_col" role="main">
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>商品分类添加</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                       aria-expanded="false">
                                        <i class="fa fa-wrench"></i>
                                    </a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <div id="datatable-checkbox_wrapper"
                                 class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                                <div class="row">
                                    <div class="col-sm-12 text-center" style="overflow: hidden">

                                        <form class="form-inline" action="../Category/AddCategory.do" method="post">
                                            <div class="input-group input-group-sm">
                                                <span class="input-group-addon" id="sizing-addon1">分类ID</span>
                                                <input type="text" class="form-control" name="ctgrId"
                                                       placeholder="自动生成，无需填写" disabled
                                                       aria-describedby="sizing-addon1" style="width: 120px">
                                            </div>
                                            <div class="input-group input-group-sm">
                                                <span class="input-group-addon" id="sizing-addon2">大类型</span>
                                                <input type="text" class="form-control" id="bigCtgr"
                                                       placeholder="请输入大类型"
                                                       aria-describedby="sizing-addon1" style="width: 120px">
                                            </div>
                                            <div class="input-group input-group-sm">
                                                <span class="input-group-addon" id="sizing-addon3">小类型</span>
                                                <input type="text" class="form-control" id="ctgrName"
                                                       placeholder="请输入小类型"
                                                       aria-describedby="sizing-addon1" style="width: 120px">
                                            </div>

                                            <div class="col-sm-12 text-center" id="searchBtn">
                                                <button type="button" class="btn btn-primary btn-sm added">确认保存</button>
                                                <button type="reset" class="btn btn-default btn-sm">重置</button>

                                            </div>
                                            <%--判断是否添加成功，如果添加成功则弹出模态框--%>
                                        </form>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->

    <!-- footer content -->
    <%--<footer>--%>
    <%--<div class="pull-right">--%>
    <%--Gentelella - Bootstrap Admin Template by <a href="https://colorlib.com">Colorlib</a>--%>
    <%--</div>--%>
    <%--<div class="clearfix"></div>--%>
    <%--</footer>--%>
    <!-- /footer content -->
</div>


<!-- jQuery -->
<script src="../js/jquery-2.2.4.js"></script>
<!-- Bootstrap -->
<script src="../js/bootstrap.js"></script>
<!-- FastClick -->
<script src="../css/vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="../css/vendors/nprogress/nprogress.js"></script>
<!-- Chart.js -->
<script src="../css/vendors/Chart.js/dist/Chart.min.js"></script>
<!-- gauge.js -->
<script src="../css/vendors/gauge.js/dist/gauge.min.js"></script>
<!-- bootstrap-progressbar -->
<script src="../css/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
<!-- iCheck -->
<script src="../css/vendors/iCheck/icheck.min.js"></script>
<!-- Skycons -->
<script src="../css/vendors/skycons/skycons.js"></script>
<!-- Flot -->
<script src="../css/vendors/Flot/jquery.flot.js"></script>
<script src="../css/vendors/Flot/jquery.flot.pie.js"></script>
<script src="../css/vendors/Flot/jquery.flot.time.js"></script>
<script src="../css/vendors/Flot/jquery.flot.stack.js"></script>
<script src="../css/vendors/Flot/jquery.flot.resize.js"></script>
<!-- Flot plugins -->
<script src="../css/vendors/flot.orderbars/js/jquery.flot.orderBars.js"></script>
<script src="../css/vendors/flot-spline/js/jquery.flot.spline.min.js"></script>
<script src="../css/vendors/flot.curvedlines/curvedLines.js"></script>
<!-- DateJS -->
<script src="../css/vendors/DateJS/build/date.js"></script>
<!-- Datatables -->
<script src="../css/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="../css/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="../css/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
<script src="../css/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
<script src="../css/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
<script src="../css/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
<script src="../css/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
<script src="../css/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
<script src="../css/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
<script src="../css/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
<script src="../css/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
<script src="../css/vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
<script src="../css/vendors/jszip/dist/jszip.min.js"></script>
<script src="../css/vendors/pdfmake/build/pdfmake.min.js"></script>
<script src="../css/vendors/pdfmake/build/vfs_fonts.js"></script>
<!-- JQVMap -->
<script src="../css/vendors/jqvmap/dist/jquery.vmap.js"></script>
<script src="../css/vendors/jqvmap/dist/maps/jquery.vmap.world.js"></script>
<script src="../css/vendors/jqvmap/examples/js/jquery.vmap.sampledata.js"></script>
<!-- bootstrap-daterangepicker -->
<script src="../css/vendors/moment/min/moment.min.js"></script>
<script src="../css/vendors/bootstrap-daterangepicker/daterangepicker.js"></script>

<!-- Mainly scripts -->
<script src="../js/framework/metisMenu/jquery.metisMenu.js"></script>
<script src="../js/framework/slimscroll/jquery.slimscroll.min.js"></script>

<!-- Custom and plugin javascript -->
<script src="../js/framework/inspinia.js"></script>
<script src="../js/framework/pace/pace.min.js"></script>

<!-- Sweet alert -->
<script src="../js/framework/sweetalert/sweetalert.min.js"></script>

<!-- Custom Theme Scripts -->
<script src="../css/build/js/custom.min.js"></script>

<script>
    $(function () {


        $('[data-toggle="tooltip"]').tooltip();
        $('[data-toggle="popover"]').popover();
        $('tbody tr td:nth-child(9) a').mouseenter(function () {
            $('tbody tr td:nth-child(9) img').show();
        }).mouseout(function () {
            $('tbody tr td:nth-child(9) img').hide();
        });
    });
    <%--判断是否添加成功，如果添加成功则弹出模态框--%>
    $('.added').click(function(){



        var bigCtgr = $('#bigCtgr').val();
        var ctgrName = $('#ctgrName').val();
        $.get("../Category/AddCategory.do",
            {"bigCtgr":bigCtgr,"ctgrName":ctgrName},
            function (res) {
        if (res.result) {
            swal({
                title: "添加结果",
                text: "成功" },
                function () {
                    location.reload();
            });
        } else {
            swal({
                title: "添加结果",
                text: "失败！",
                type: "error"
            });
        }

    },"json");


    });



</script>

</body>
</html>